

$(function () {

    ylq_category_title();




    function ylq_category_title(){//获取头部数据
        $.ajax({
            type: "get",
            url: "http://193.112.55.79:9090/api/getcategorytitle",
            dataType: "json",
            success: function (response) {
                let data = response.result;
                 let html=template('ylq_category_tamp',{arr:data});
                $('.ylq_category_view').html(html);
            }
        });
    }




    $('.ylq_category_view').on('tap','.mui-table-view',function(){//获取li数据
      console.log($('.ylq_category_panel_ul'))   
      let  number=$(this).index()//获取索引
      let main_ul=$('.ylq_category_panel_ul').eq(number);//获取当前点击的ul下面的存放内容的ul

                let url_a = "http://193.112.55.79:9090/api/getcategory?titleid=" + $(this).index();
                $.ajax({
                    type: "get",
                    url: url_a,
                    dataType: "json",
                    success: function (response) {
                        let data=response.result;
                        let html='';
                      for(let i=0;i<data.length;i++ ){
                          console.log(data[i]._id);
                        html+='<li><a href="ylq_category_main.html?categoryId='+data[i].categoryId+'">'+data[i].category +'</a></li>';
                      }
                      
                      
                      main_ul.html(html);
                    }
                });
    })








})

